package com.hundsun.cprs.yyt.common.enums;

import java.util.HashMap;
import java.util.Map;

public enum EnumAreaCode {
    WHOLESALE_AREA("wholesale_area","批发区"),
    RETAIL_AREA("retail_area","零售区");

    /** 状态值 */
    private String code;
    /** 状态值说明 */
    private String desc;

    private EnumAreaCode(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 全局索引池
     */
    private static Map<String, EnumAreaCode> pool = new HashMap<String, EnumAreaCode>();
    static {
        for (EnumAreaCode et : EnumAreaCode.values()) {
            pool.put(et.code + "", et);
        }
    }

    /**
     * 根据内容索引
     *
     * @param code
     * @return
     */
    public static EnumAreaCode indexByValue(String code) {
        return pool.get(code);
    }

    public static Map<String, EnumAreaCode> toMap() {
        return pool;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
